class CreateSalesInvoices < ActiveRecord::Migration[5.1]
  def change
    create_table :sales_invoices do |t|
      t.integer :firm_id, comment: '对应公司'
      t.integer :order_id, comment: '相关订单'
      t.integer :finance_info_id, comment: '公司开票信息'
      t.integer :created_by, comment: '操作人'
      t.float :invoice_money, comment: '发票金额'
      t.integer :invoice_type, comment: '发票类型'
      t.string :invoice_num, comment: '发票号'
      t.datetime :invoice_date, comment: '开票时间'
      t.string :notes

      t.timestamps
    end
    add_index :sales_invoices, :firm_id
    add_index :sales_invoices, :order_id
    add_index :sales_invoices, :finance_info_id
    add_index :sales_invoices, :created_by
    add_index :sales_invoices, :invoice_type
    add_index :sales_invoices, :invoice_date
  end
end
